<template>
  <div>
    <catgory-left :leftList="leftList" @itemClick="setKey"/>
    <catgory-list  :maitKey="Key" ref="list"/>
  </div>
</template>

<script>
import CatgoryLeft from "./childComps/CatgoryLeft.vue";
import { getCatgory } from "@/network/catgory.js";
import CatgoryList from "./childComps/CatgoryList.vue";
export default {
  components: { CatgoryLeft, CatgoryList },
  name: "Category",

  data() {
    return {
      leftList: {},
      Key:5253
    };
  },
  computed:{
  },
  mounted() {},

  methods: {
    getCatgory() {
      getCatgory().then((res) => {
        this.leftList = res.data.category.list;
      });
    },
    setKey(key){
      this.Key= parseInt(key)
      this.$refs.list.$refs.scroll.scrollTo(0,0,10)
    }
  },
  created() {
    this.getCatgory();
  },
};
</script>

<style lang="css" scoped>
</style>